package com.wd.live.module_base.net.util

import com.wd.base.bean.LabelsBean
import com.wd.live.module_base.net.bean.list.FindLeaderBoardBean
import com.wd.live.module_base.net.bean.live.CloseLiveBean
import com.wd.live.module_base.net.bean.live.FindFansInteractListBean
import com.wd.live.module_base.net.bean.live.LiveData
import com.wd.live.module_base.net.bean.live.OpenLiveBean
import com.wd.live.module_base.net.bean.live.ResultBean
import com.wd.live.module_base.net.bean.login.FindConstellationListBean
import com.wd.live.module_base.net.bean.login.FindLabelsBean
import com.wd.live.module_base.net.bean.login.LoginBean
import com.wd.live.module_base.net.bean.my.FindPrivateLetterListBean
import com.wd.live.module_base.net.bean.wide.FindGiftRecordByUidBean
import com.wd.live.module_base.net.bean.wide.FindLiveListBean
import com.wd.live.module_base.net.bean.wide.FindLiveTypeListBean
import com.wd.live.module_base.net.bean.wide.FindRecommendConstellationBean
import com.wd.live.module_base.net.bean.wide.WatchLiveBean
import com.wd.live.module_base.ui.base.BaseResult
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Part
import retrofit2.http.Query


/**
 * 作者: 王晶晶
 * 时间:2024/5/16
 * 描述:
 */
interface ApiService {

    @GET("live-user/verify/findLabels")
    suspend fun getLabels(@Header("userId") userId:Int,
                          @Header("sessionId") sessionId: String): BaseResult<List<LabelsBean>>
    //登录
    @POST("live-user/v1/login")
    suspend fun postLogin(
        @Body body: Map<String,String>
    ): BaseResult<LoginBean>
//    查询直播列表
    @GET("live-platform/findLiveList")
    suspend fun getFindLiveList(
        @Query("liveType") liveType:Int,
        @Query("page") page:Int,
        @Query("size") size:Int,
    ): BaseResult<List<FindLiveListBean>>
//    查询直播类型
    @GET("live-platform/findLiveTypeList")
    suspend fun getFindLiveTypeList(): BaseResult<List<FindLiveTypeListBean>>

    //suspend 挂起函数
//todo 微信登录 18
    @FormUrlEncoded
    @POST("live-user/wxLogin")
    suspend fun postWXLogin(
        @Field("code") code: String
    ): BaseResult<LoginBean>

    //修改用户性别
    @PUT("live-user/verify/modifySex")
    suspend fun putModifySex(
        @Query("sex") sex: Int
    ): BaseResult<String?>

    //    查询星座列表 18
    @GET("live-user/findConstellationList")
    suspend fun getFindConstellationList(): BaseResult<List<FindConstellationListBean>>

    //    修改用户星座
    @PUT("live-user/verify/modifyConstellation")
    suspend fun putModifyConstellation(
        @Query("constellationId") constellationId: Int
    ): BaseResult<String?>

    //    用户添加标签
    @POST("live-user/verify/saveTag")
    suspend fun postSaveTag(
        @Query("labelIds") labelIds: String
    ): BaseResult<String?>

    //    查询所有标签
    @GET("live-user/verify/findLabels")
    suspend fun getFindLabels(): BaseResult<List<FindLabelsBean>>

    //    查询推荐匹配星座列表
    @GET("live-user/verify/findRecommendConstellation")
    suspend fun getFindRecommendConstellation(
        @Query("count") count: Int,
        @Query("maxFriendId") maxFriendId: Int
    ): BaseResult<List<FindRecommendConstellationBean>>

    //    查询排行榜数据
    @GET("live-platform/findLeaderBoard")
    suspend fun getFindLeaderBoard(): BaseResult<FindLeaderBoardBean>

//    用户修改上传头像

    @Multipart
    @POST("live-user/verify/modifyHeadPic")
    suspend fun postModifyHeadPic(@Part part: MultipartBody.Part):BaseResult<String?>
//    申请开启直播（主播）
    @Multipart
    @POST("live-platform/verify/openLive")
    suspend fun postOpenLive(
        @Query("liveType") liveType:Int,
        @Query("liveTitle") liveTitle:String,
        @Query("longitude") longitude:String,
        @Query("latitude") latitude:String,
        @Part part: MultipartBody.Part
    ): OpenLiveBean<ResultBean>
    //开始推流（agora）
    @PUT("ive-platform/verify/startPushStream")
    suspend fun putStartPushStream(
        @Query("liveId") liveId:Int
    ): BaseResult<String?>
//    关闭直播（主播）
    @DELETE("live-platform/verify/closeLive")
    suspend fun deleteCloseLive(
): BaseResult<CloseLiveBean>
    //观看直播（观众）
    @GET("live-platform/watchLive")
    suspend fun getWatchLive(@Query("liveId") liveId:Int):BaseResult<WatchLiveBean>
//            http://172.17.8.100/live-platform/recordVideo/{liveId}
//    主播查询连麦互动列表
    @GET("live-platform/verify/findFansInteractList")
    suspend fun getFindFansInteractList(@Query("liveId") liveId:Int):BaseResult<List<FindFansInteractListBean>>
//    主播同意观众连麦申请
    @PUT("live-platform/verify/passFansInteract")
    suspend fun putPassFansInteract(
    @Query("liveId") liveId:Int,
    @Query("fansId") fansId:Int):BaseResult<String?>

    //    主播开启搭鹊桥

    @POST("live-platform/verify/magpieBridge")
    suspend fun postMagpieBridge(
        @Query("liveId") liveId: Int
    ): BaseResult<String?>

    //    查询礼物来往记录
    @GET("live-user/verify/findGiftRecordByUid")
    suspend fun getFindGiftRecordByUid(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @Query("type") type: Int,
        @Query("page") page: Int,
        @Query("size") size: Int,
    ): BaseResult<List<FindGiftRecordByUidBean>>


    //查询我的私信列表
    @GET("live-user/verify/findPrivateLetterList")
    suspend fun getFindPrivateLetterList(): BaseResult<List<FindPrivateLetterListBean>>
}